package com.qhad.ads.activity;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.qhad.ads.sdk.interfaces.IQhLandingPageListener;
import com.qhad.ads.sdk.interfaces.IQhLandingPageView;



public class CustomLandingPageView implements IQhLandingPageView {

    private static final String LOG_TAG = CustomLandingPageView.class.getSimpleName();


    @Override
    public void open(Context context, String url, IQhLandingPageListener listener) {
        if (url == null) {
            Log.e(LOG_TAG, "custom landing page disabled by sdk.");
            return;
        }
        CustomLandingPageActivity.ldUrl = url;
        CustomLandingPageActivity.listener = listener;
        Intent intent = new Intent(context, CustomLandingPageActivity.class);
        try {
            context.startActivity(intent);
        } catch (Exception e) {
            Log.e(LOG_TAG, "unable start activity.", e);
            listener.onPageLoadFailed();
        }
    }
}
